package com.yhn.shortlink.project.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yhn.shortlink.common.model.BaseResponse;
import com.yhn.shortlink.common.model.ResultUtils;
import com.yhn.shortlink.project.dto.req.RecycleBinSaveReqDTO;
import com.yhn.shortlink.project.dto.req.ShortLinkPageReqDTO;
import com.yhn.shortlink.project.dto.resp.ShortLinkPageRespDTO;
import com.yhn.shortlink.project.service.RecycleBinService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

/**回收站控制层
 * @author yhn
 * @version 1.0
 * @description
 * @date 2024/8/7 14:06
 */
@RestController
@RequestMapping("/bin")
public class RecycleBinController {
    @Resource
    private RecycleBinService recycleBinService;

    @PostMapping("/save")
    public BaseResponse<Boolean> saveRecycleBin(@RequestBody RecycleBinSaveReqDTO requestParam) {
        return ResultUtils.success(recycleBinService.saveRecycleBin(requestParam));
    }

    /**
     * 回收站
     * @return 分页信息
     */
    @GetMapping("/page")
    public BaseResponse<IPage<ShortLinkPageRespDTO>> pageLink(ShortLinkPageReqDTO shortLinkPageReqDTO) {
        return ResultUtils.success(recycleBinService.pageShortLinkBin(shortLinkPageReqDTO));
    }
}

